package cn.iune.web.backcenter.controllers;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.alibaba.fastjson.JSONObject;

import cn.iune.system.monitor.Server;

/**
 * 服务器监控
 * 
 */
@Controller
@RequestMapping("/backcenter/monitor")
public class ServerMonitorController {
	
	@RequestMapping(value="/server",method=RequestMethod.GET)
    public ModelAndView server()
    {
		ModelAndView mav = new ModelAndView("/backcenter/monitor/server");
//		mav.addObject("person",principals);
		return mav;
    }
	
	@RequestMapping(value = "/getServerInfo", method = RequestMethod.GET)
	@ResponseBody
	public JSONObject getServerInfo(HttpServletRequest request) {
		
        Server server = new Server();
        try {
			server.copyTo();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
        
        JSONObject json = (JSONObject) JSONObject.toJSON(server);
        System.out.println(json);
        
		return json;
	}

	
	
}
